#include<iostream>
#include<algorithm>
#include<string>
#include "deque.h"
using namespace std;
void Test1()
{
	//Mydeque::deque<int> q(5, 1);
	//q.push_back(2);
	//q.push_front(3);
	////q.insert(q.begin() + 2, 10);
	////q.erase(q.begin() + 3);
	//q.pop_back();
	//q.pop_front();
	//for (auto& e : q)
	//{
	//	cout << e << " ";
	//}
	//cout << endl;
	//cout << q[3] << endl;

	Mydeque::deque<int> q(5, 1);
	q.push_back(2);
	q.push_front(3);
	q.insert(q.begin() + 3, 10);
	q.insert(q.end(), 20);
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	q.erase(q.begin() + 3);
	q.erase(q.begin());
	q.pop_back();
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	q.clear();
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
}
void Test2()
{
	Mydeque::deque<string> q(5, "hello world");
	for (auto& e : q)
	{
		cout << e << "\n";
	}
	cout << endl;
	q.pop_back();
	q.insert(q.end(), "hello bit");
	q.erase(q.begin());
	for (auto& e : q)
	{
		cout << e << "\n";
	}
	cout << endl;
}
void Test3()
{
	Mydeque::deque<int> q(5, 1);
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	Mydeque::deque<int> q1(3, 2);
	q.insert(q.begin(), q1.begin(), q1.end());
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	q.insert(q.end(), q1.begin(), q1.end());
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	Mydeque::deque<int> q2(3, 3);
	q.insert(q.begin() + 3, q2.begin(), q2.end());
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	Mydeque::deque<int> q3(3, 4);
	q.insert(q.begin() + 6, q3.begin(), q3.end());
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
}
void Test4()
{
	Mydeque::deque<int> q(10, 1);
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	q.erase(q.begin(), q.begin() + 5);
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
	q.insert(q.begin() + 2, 2);
	q.erase(q.begin(), q.begin() + 2);
	for (auto& e : q)
	{
		cout << e << " ";
	}
	cout << endl;
}
int main()
{
	//Test1();
	//Test2();
	//Test3();
	Test4();
	return 0;
}